package constants

import (
	"ch05/instructions/base"
	"ch05/rtda"
)

type ILOAD struct {
	base.Index8Instruction
}

type ILOAD_0 struct {
	base.NoOperandsInstruction
}
type ILOAD_1 struct {
	base.NoOperandsInstruction
}
type ILOAD_2 struct {
	base.NoOperandsInstruction
}
type ILOAD_3 struct {
	base.NoOperandsInstruction
}

func _iload(frame rtda.Frame, index uint)  {
	val := frame.LocalVars().GetInt(index)
	frame.OperandStack().PushInt(val)
}

func (self *ILOAD) Execute(frame rtda.Frame) {
	_iload(frame,self.Index)
}

func (self *ILOAD_1) Execute(frame rtda.Frame) {
	_iload(frame,1)
}
